$(document).ajaxComplete(function (event, xhr, settings) {
    console.log("ajaxComplete ")
    redirectHandle(xhr);
})

function redirectHandle(xhr) {
    //获取后台返回的参数
    var url = xhr.getResponseHeader("redirectUrl");
    console.log("redirectUrl = " + url);
    var enable = xhr.getResponseHeader("enableRedirect");
    if((enable == "true") && (url != "")){
        var win = window;
        while(win != win.top){
            win = win.top;
        }
        layer.msg('您还未登录，请先登录');
        setTimeout(function () {
            win.location.href = url;
        },500)

    }
}